2 * Adium is the legal property of its developers, whose names are listed in the copyright file included
3 * with this source distribution.
5 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6 * General Public License as published by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11 * Public License for more details.
13 * You should have received a copy of the GNU General Public License along with this program; if not,
14 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 #import "ESGaimNotifyEmailController.h"
18 #import "adiumGaimNotify.h"
19 #import "SLGaimCocoaAdapter.h"
20 #import <AIUtilities/CBObjectAdditions.h>
22 static void *adiumGaimNotifyMessage(GaimNotifyMsgType type, const char *title, const char *primary, const char *secondary, GCallback cb,void *userData)
24 GaimDebug (@"adiumGaimNotifyMessage: type: %i\n%s\n%s\n%s ",
27 (primary ? primary : ""),
28 (secondary ? secondary : ""));
30 return ([[SLGaimCocoaAdapter sharedInstance] handleNotifyMessageOfType:type
33 secondary:secondary]);
36 static void *adiumGaimNotifyEmails(size_t count, gboolean detailed, const char **subjects, const char **froms, const char **tos, const char **urls, GCallback cb,void *userData)
38 //Values passed can be null
39 return([ESGaimNotifyEmailController handleNotifyEmails:count
47 static void *adiumGaimNotifyEmail(const char *subject, const char *from, const char *to, const char *url, GCallback cb,void *userData)
49 return(adiumGaimNotifyEmails(1,
51 (subject ? &subject : NULL),
52 (from ? &from : NULL),
58 static void *adiumGaimNotifyFormatted(const char *title, const char *primary, const char *secondary, const char *text, GCallback cb,void *userData)
60 GaimDebug (@"adiumGaimNotifyFormatted: %s\n%s\n%s\n%s ",
62 (primary ? primary : ""),
63 (secondary ? secondary : ""),
66 return ([[SLGaimCocoaAdapter sharedInstance] handleNotifyFormattedWithTitle:title
72 static void *adiumGaimNotifyUserinfo(GaimConnection *gc, const char *who, const char *title, const char *primary, const char *secondary, const char *text, GCallback cb,void *userData)
74 NSString *textString = [NSString stringWithUTF8String:text];
76 if (GAIM_CONNECTION_IS_VALID(gc)){
77 GaimAccount *account = gc->account;
78 GaimBuddy *buddy = gaim_find_buddy(account,who);
79 AIListContact *theContact = contactLookupFromBuddy(buddy);
82 [accountLookup(account) mainPerformSelector:@selector(updateUserInfo:withData:)
84 withObject:textString];
87 return(adium_gaim_get_handle());
90 static void *adiumGaimNotifyUri(const char *uri)
93 NSURL *notifyURI = [NSURL URLWithString:[NSString stringWithUTF8String:uri]];
94 [[NSWorkspace sharedWorkspace] openURL:notifyURI];
97 return(adium_gaim_get_handle());
100 static void adiumGaimNotifyClose(GaimNotifyType type,void *uiHandle)
102 GaimDebug (@"adiumGaimNotifyClose");
105 static GaimNotifyUiOps adiumGaimNotifyOps = {
106 adiumGaimNotifyMessage,
107 adiumGaimNotifyEmail,
108 adiumGaimNotifyEmails,
109 adiumGaimNotifyFormatted,
110 adiumGaimNotifyUserinfo,
115 GaimNotifyUiOps *adium_gaim_notify_get_ui_ops(void)
117 return &adiumGaimNotifyOps;